﻿<UserControl x:Class="CustomControls.BusyIndicator"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            >
    <UserControl.Resources>
        <!-- ReSharper disable once Xaml.RedundantResource -->
        <Storyboard x:Key="GridStoryBoard">
            <DoubleAnimation 
                            Storyboard.TargetName="RtAngle" 
                            Storyboard.TargetProperty="Angle"
                            Duration="0:1:0"
                            RepeatBehavior="Forever"
                            From="0" To="360" />
        </Storyboard>
        <!-- ReSharper disable once Xaml.RedundantResource -->
        <Storyboard x:Key="EllipseStoryBoard">
                <DoubleAnimation 
                                Storyboard.TargetName="SlateBlueStop" 
                                Storyboard.TargetProperty="Offset"
                                From="0.2" To="1"
                                AutoReverse="True"
                                RepeatBehavior="Forever"
                                Duration="0:0:4"
                                >
                    <DoubleAnimation.EasingFunction>
                        <SineEase EasingMode="EaseInOut"/>
                    </DoubleAnimation.EasingFunction>
                </DoubleAnimation>
                <DoubleAnimation 
                                Storyboard.TargetName="NavyStop" 
                                Storyboard.TargetProperty="Offset"
                                From="0" To="1"
                                AutoReverse="True"
                                RepeatBehavior="Forever"
                                Duration="0:0:7.5"
                                ></DoubleAnimation>
        </Storyboard>
    </UserControl.Resources>
    <Viewbox>
        <DockPanel>
            <TextBlock DockPanel.Dock="Top" Text="Working..." FontSize="30" VerticalAlignment="Center" HorizontalAlignment="Center"/>
            <Grid DockPanel.Dock="Top" Background="Transparent">
                <Grid.Resources>
                </Grid.Resources>
                <Ellipse Width="100" Height="100" StrokeThickness="5">
                    <Ellipse.Fill>
                        <RadialGradientBrush Center="0.5,0.5" GradientOrigin="0.8,0.8" 
                                     RadiusX="0.5" RadiusY="0.5" MappingMode="RelativeToBoundingBox"
                                     >
                            <GradientStop Offset="0" Color="MediumPurple"/>
                            <GradientStop Offset="0.05" Color="MediumSlateBlue" x:Name="SlateBlueStop"/>
                            <GradientStop Offset="0.1" Color="Wheat" x:Name="MidGradientStop"/>
                            <GradientStop Offset="1" Color="Plum"/>
                        </RadialGradientBrush>
                    </Ellipse.Fill>
                    <Ellipse.Stroke>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                            <GradientStop Offset="0" Color="Navy" x:Name="NavyStop"/>
                            <GradientStop Offset="1" Color="Turquoise"/>
                        </LinearGradientBrush>
                    </Ellipse.Stroke>
                    <Ellipse.RenderTransform>
                        <RotateTransform CenterX="0.5" CenterY="0.5" Angle="0"/>
                    </Ellipse.RenderTransform>
                    <!--<Ellipse.Triggers>
                        <EventTrigger RoutedEvent="Ellipse.Loaded">
                            <BeginStoryboard Storyboard="{StaticResource EllipseStoryBoard}"/>
                        </EventTrigger>
                    </Ellipse.Triggers>-->
                </Ellipse>
                <Grid.RenderTransformOrigin>
                    <Point X="0.5" Y="0.5"/>
                </Grid.RenderTransformOrigin>
                <Grid.RenderTransform>
                    <RotateTransform CenterX="0" CenterY="0" Angle="0" x:Name="RtAngle"/>
                </Grid.RenderTransform>
                <!--<Grid.Triggers>
                    <EventTrigger RoutedEvent="Grid.Loaded">
                        <BeginStoryboard Storyboard="{StaticResource GridStoryboard}"/>
                    </EventTrigger>
                </Grid.Triggers>-->
            </Grid>
        </DockPanel>
    </Viewbox>
</UserControl>
